package com.rd.student.jiaji.class1.jinhongyu.day0808;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Test01 {
    public static void main(String[] args) throws IOException {

        String strr = "杜兰特,勇士队,威少,雷霆队,库里,勇士队,石破天,湖人队,科比,湖人队";
        String[] strarr = strr.split(",");

        Map map = new HashMap();
        for (int i = 0; i < strarr.length; i++) {
            map.put(strarr[i],strarr[++i]);
        }

        System.out.println("请输入球员名:");
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String s = String.valueOf(map.get(str));
        Set set = map.keySet();
        boolean b = false;
        for (Object o : set) {
            if (str.equals(o)){
                b = true;
                break;
            }
        }
        if (b == true){
            System.out.println(str +"所属"+ s);
        }else{
            System.out.println("不存在该球员");
        }
    }
}
